import { AddUserModel } from '@/api/user/userModel'
import { reactive } from 'vue'
export default function formDataDialog() {
    // 表单绑定的数据
    const formData = reactive<AddUserModel>({
        id: '', // 判断新增还是编辑
        type: '',
        deptId: '',
        deptName: '',
        loginName: '',
        mobile: '',
        nickName: '',
        email: '',
        username: '',
        password: '',
        sex: ''
    })
    // 表单验证规则
    const rules = reactive({
        deptName: [{
            required: true,
            message: '请选择上级部门',
            trigger: 'change'
        }],
        loginName: [{
            required: true,
            message: '请填写姓名',
            trigger: 'change'
        }],
        mobile: [{
            required: true,
            message: '请填写电话',
            trigger: 'change'
        }],
        username: [{
            required: true,
            message: '请填写登录',
            trigger: 'change'
        }],
        password: [{
            required: true,
            message: '请填写密码',
            trigger: 'change'
        }],
        sex: [{
            required: true,
            message: '请选择性别',
            trigger: 'change'
        }]
    })
    return {
        formData,
        rules
    }
}